import 'package:flutter/material.dart';
import 'package:get/get.dart';

extension GetExtension on GetInterface {
  ///隐藏dialog
  dismiss() {
    if (Get.isDialogOpen != null && Get.isDialogOpen!) {
      Get.back();
    }
  }

  ///显示dialog
  showLoading({String text = ''}) {
    if (Get.isDialogOpen != null && Get.isDialogOpen!) {
      Get.back();
    }
    Get.dialog(
      Center(
        child: SizedBox(width: 50, height: 50, child: CircularProgressIndicator()),
      ),
      barrierColor: Colors.transparent,
      transitionDuration: const Duration(milliseconds: 500),
      barrierDismissible: false,
    );
  }
}
